﻿CREATE PROCEDURE [dbo].[Chapter_GetInfo]
	@hashTag NVARCHAR(128) = NULL
	,	@userId UNIQUEIDENTIFIER = NULL
AS
BEGIN
	DECLARE @chapterId UNIQUEIDENTIFIER, @bookId UNIQUEIDENTIFIER

	--SELECT @chapterId = [ChapterId], @bookId = [BookId]
	--FROM [dbo].[text_Chapter]
	--WHERE LOWER([HashTag]) = LOWER(@hashTag) AND [ParentChapterId] IS NOT NULL 

	--IF @chapterId IS NULL
	--	RAISERROR ('UnknownUrl', 16, 1)

	--SELECT @chapterId AS [ChapterId]

	--------------------- BOOK INFO ------------------------
	--SELECT b.[BookId]
	--			,	[ChapterId]
	--			,	[HashTag]
	--			,	[IsPublished]
	--			,	[Title]
	--			,	[Author]
	--			,	[CoverUrl]
	--FROM [dbo].[text_Chapter] AS c
	--INNER JOIN [dbo].[text_Book] AS b on c.[BookId] = b.[BookId]
	--WHERE b.[BookId] = @bookId
	--------------------- BOOK INFO ------------------------
	--------------------- CHAPTERS INFO ------------------------
	--SELECT [ChapterId]
	--			,[ParentChapterId]
	--			,[BookId]
	--			,[HashTag]
	--			,[IsPublished]
	--			, /*CASE WHEN [Cost] IS NULL
	--				THEN NULL
	--				ELSE
	--					[dbo].[GetChapterCost]([ChapterId], @userId, [Cost])
	--				END*/ NULL AS [Cost]
	--			,[Order]
	--			,[Title]
	--			,[Hint]
	--FROM [dbo].[text_Chapter]
	--WHERE [ChapterId] = @chapterId
	--------------------- CHAPTERS INFO ------------------------

END